group '{{groupId}}'
version '{{artifactVersion}}'

wrapper {
    gradleVersion = '6.8.3'
    distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

buildscript {
    ext.kotlin_version = '1.5.10'
    {{#jvm-retrofit2}}
    ext.retrofitVersion = '2.9.0'
    {{/jvm-retrofit2}}
    {{#useRxJava}}
    ext.rxJavaVersion = '1.3.8'
    {{/useRxJava}}
    {{#useRxJava2}}
    ext.rxJava2Version = '2.2.21'
    {{/useRxJava2}}
    {{#useRxJava3}}
    ext.rxJava3Version = '3.0.12'
    {{/useRxJava3}}

    repositories {
        maven { url "https://repo1.maven.org/maven2" }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        {{#kotlinx_serialization}}
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
        {{/kotlinx_serialization}}
    }
}

apply plugin: 'kotlin'
{{#moshiCodeGen}}
apply plugin: 'kotlin-kapt'
{{/moshiCodeGen}}
{{#parcelizeModels}}
apply plugin: 'kotlin-parcelize'
{{/parcelizeModels}}
{{#kotlinx_serialization}}
apply plugin: 'kotlinx-serialization'
{{/kotlinx_serialization}}

repositories {
    maven { url "https://repo1.maven.org/maven2" }
}

test {
    useJUnitPlatform()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    {{^doNotUseRxAndCoroutines}}
    {{#useCoroutines}}
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"
    {{/useCoroutines}}
    {{/doNotUseRxAndCoroutines}}
    {{#moshi}}
    {{^moshiCodeGen}}
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
    implementation "com.squareup.moshi:moshi-adapters:1.12.0"
    {{/moshiCodeGen}}
    {{#moshiCodeGen}}
    implementation "com.squareup.moshi:moshi:1.12.0"
    implementation "com.squareup.moshi:moshi-adapters:1.12.0"
    kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"
    {{/moshiCodeGen}}
    {{/moshi}}
    {{#gson}}
    implementation "com.google.code.gson:gson:2.8.7"
    {{/gson}}
    {{#jackson}}
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3"
    {{/jackson}}
    {{#kotlinx_serialization}}
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
    {{/kotlinx_serialization}}
    {{#jvm-okhttp3}}
    implementation "com.squareup.okhttp3:okhttp:3.12.13"
    {{/jvm-okhttp3}}
    {{#jvm-okhttp4}}
    implementation "com.squareup.okhttp3:okhttp:4.9.1"
    {{/jvm-okhttp4}}
    {{#threetenbp}}
    implementation "org.threeten:threetenbp:1.5.1"
    {{/threetenbp}}
    {{#jvm-retrofit2}}
    {{#hasOAuthMethods}}
    implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
    {{/hasOAuthMethods}}
    implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
    {{#useRxJava}}
    implementation "io.reactivex:rxjava:$rxJavaVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
    {{/useRxJava}}
    {{#useRxJava2}}
    implementation "io.reactivex.rxjava2:rxjava:$rxJava2Version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    {{/useRxJava2}}
    {{#useRxJava3}}
    implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version"
    implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
    {{/useRxJava3}}
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    {{#gson}}
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    {{/gson}}
    {{#moshi}}
    implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
    {{/moshi}}
    {{#kotlinx_serialization}}
    implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
    {{/kotlinx_serialization}}
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
    {{/jvm-retrofit2}}
    testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
}
{{#kotlinx_serialization}}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
    }
}
{{/kotlinx_serialization}}
